define(['wiseMen/dataModel/QueryDefTpl'],function(QueryDefTpl){
	webUtils.nameSpace("QueryBuilder");
	
	var QueryBuilder=function(params){
		this.gridViewDom=$("<div>"
				+'<div class="box-header with-border">'
				
				+'<h3 class="box-title">'
				+(params.title?params.title:'')
				+"</h3>"
				
				+'<div class="box-tools pull-right">'
				+'<div class="form-inline" role="form"></div>'
				+"</div>"
				
				+"</div>"
				
				+'<div class="box-body">'
				+'<table style="width:100%"></table>'
				+"</div>"
				
				+'<div class="box-script" div style="display: none;">'
				+"</div>"
				
				+"</div>");
		$(params.target).append(this.gridViewDom);
		this.gridDef=new QueryDefTpl($.extend({
			code:params.code,
			scriptDiv:this.gridViewDom.find(".box-script"),//引用脚本的div
			toolBarDiv:this.gridViewDom.find(".box-tools .form-inline"),//工具栏定义栏
			gridDiv:this.gridViewDom.find("table"),
			model:params.model,
			queryDatas:params.queryDatas
		},params));
	}
	QueryBuilder.prototype.search=function(params){
		this.gridDef.search(params);
	}
	
	QueryBuilder.prototype.getGridViewDom=function(){
		return this.getGridViewDom;
	}
	QueryBuilder.prototype.getGridDef=function(){
		return this.gridDef;
	}
	
	return QueryBuilder;
});

		
		